package org.blankie.util;

import org.blankie.lang.Validate;

public class SynchronizedObjectRegistryWrapper<I, T extends Identified<I>> implements ObjectRegistry<I, T> {
    
    private final ObjectRegistry<I, T> delegate;
    
    public SynchronizedObjectRegistryWrapper(ObjectRegistry<I, T> registry) {
        Validate.parameterNotNull("registry", registry);
        this.delegate = registry;
    }

    @Override
    public synchronized T search(I id) {
        return delegate.search(id);
    }

    @Override
    public synchronized void register(T object) {
        delegate.register(object);
    }

}
